﻿using SceneTester.Scenes;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;

namespace SceneTester
{
    static class Program
    {

        private static readonly Size WINDOW_SIZE = new Size(800, 800);

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            GameInput input = GameInput.GetInstance();

            GameWindow gameWindow = new GameWindow();
            gameWindow.Size = WINDOW_SIZE;

            Camera camera = new Camera(0, 0, WINDOW_SIZE.Width, WINDOW_SIZE.Height);

            LoadMenu lm = new LoadMenu(gameWindow.CreateGraphics(), camera);
            lm.Load(ProgressTest);

            new Thread(() => { StartLoadMenu(gameWindow, lm); }).Start();

           
            Application.Run(gameWindow);
        }

        private static void StartLoadMenu(GameWindow gameWindow, LoadMenu lm)
        {
            while (!gameWindow.Visible) ;

            lm.OnExitEvent += OnExitTest;
            lm.Play();
        }

        private static void OnExitTest()
        {
            MessageBox.Show("Exited!");
        }

        private static void ProgressTest(int prog)
        {
            MessageBox.Show("Progress: " + prog);
        }
    }
}
